import Vue from 'vue'
import VueRouter from 'vue-router'

const Home = r => require.ensure([], () => r(require('@/page/home/home')), 'home')
const Order = r => require.ensure([], () => r(require('@/page/order/order')), 'Order')
const About = r => require.ensure([], () => r(require('@/page/about/about')), 'About')
const Cart = r => require.ensure([], () => r(require('@/page/cart/cart')), 'Cart')
const CartAdd = r => require.ensure([], () => r(require('@/page/cart/components/cartAdd')), 'CartAdd')
const Address = r => require.ensure([], () => r(require('@/page/about/components/address')), 'Address')
const AddressAdd = r => require.ensure([], () => r(require('@/page/about/components/addressAdd')), 'AddressAdd')
const AddressEt = r => require.ensure([], () => r(require('@/page/about/components/addressEt')), 'AddressEt')
const Card = r => require.ensure([], () => r(require('@/page/about/components/card')), 'Card')
const Integral = r => require.ensure([], () => r(require('@/page/about/components/integral')), 'Integral')
const IntegralList = r => require.ensure([], () => r(require('@/page/about/components/integralList')), 'IntegralList')
const Admin = r => require.ensure([], () => r(require('@/page/about/components/admin')), 'Admin')
const Show = r => require.ensure([], () => r(require('@/page/home/components/show')), 'Show')
const OrderDes = r => require.ensure([], () => r(require('@/page/order/components/orderDes')), 'OrderDes')

import Mint from 'mint-ui'
import 'mint-ui/lib/style.css'
Vue.use(Mint)
Vue.use(VueRouter)

const routes = [
        {
      path: '/',
      component: Home
    },
    {
      path: '/home',
      component: Home
    },
    {
      path: '/order',
      component: Order,
      meta:{auth:true}
    },
    {
      path: '/about',
      component: About,
      meta:{auth:true}
    },
    {
      path: '/cart',
      component: Cart,
      meta:{auth:true}
    },
    {
      path: '/CartAdd',
      component: CartAdd,
      meta:{auth:true}
    },
    {
      path: '/address',
      component: Address,
      meta:{auth:true}
    },
    {
      path: '/addressAdd',
      component: AddressAdd,
      meta:{auth:true}
    },
    {
      path: '/addressEt',
      component: AddressEt,
      meta:{auth:true}
    },
    {
      path: '/card',
      component: Card,
      meta:{auth:true}
    },
    {
      path: '/integral',
      component: Integral,
      meta:{auth:true}
    },
    {
      path: '/integralList',
      component: IntegralList,
      meta:{auth:true}
    },
    {
      path: '/admin',
      component: Admin,
      meta:{auth:true}
    },
    {
      path: '/show',
      component: Show
    },
    {
      path: '/orderDes',
      component: OrderDes,
      meta:{auth:true}
    },
    {path:'*',redirect:'/home'}

  ]


const router = new VueRouter({
  mode: 'history',
  routes: routes
})


export default router